{\rtf1\ansi\ansicpg936\cocoartf1344\cocoasubrtf720
{\fonttbl\f0\fnil\fcharset134 STHeitiSC-Light;\f1\fnil\fcharset0 Menlo-Regular;}
{\colortbl;\red255\green255\blue255;\red38\green38\blue38;\red29\green133\blue25;\red180\green0\blue98;
\red48\green111\blue121;\red77\green0\blue158;\red46\green13\blue110;\red92\green38\blue153;\red0\green11\blue255;
\red186\green0\blue17;\red110\green32\blue13;}
\paperw11900\paperh16840\margl1440\margr1440\vieww22500\viewh8300\viewkind0
\deftab720
\pard\pardeftab720\qj

\f0\b\fs60 \cf2 \expnd0\expndtw0\kerning0
UITextView\'ce\'c4\'b1\'be\'ca\'d3\'cd\'bc\
\pard\tx1204\pardeftab1204\pardirnatural

\b0\fs50 \cf0 \kerning1\expnd0\expndtw0 \CocoaLigature0 \'b1\'c8\'bd\'cf
\f1 TextView
\f0 \'ba\'cd
\f1 TextField\
    \cf3 //textView
\f0 \'bf\'c9\'d2\'d4\'d3\'c3\'d7\'f7\'ca\'e4\'c8\'eb\'a3\'ac\'d2\'b2\'bf\'c9\'d2\'d4\'d3\'c3\'d3\'da\'cf\'d4\'ca\'be\'a3\'a8\'cb\'fc\'bf\'c9\'d2\'d4\'bd\'ab\'b5\'e7\'bb\'b0\'a3\'ac\'b5\'d8\'d6\'b7\'a3\'ac\'d3\'ca\'cf\'e4\'a3\'ac\'cd\'f8\'d6\'b7\'ca\'b6\'b1\'f0\'b3\'f6\'c0\'b4\'a3\'a9
\f1 ,
\f0 \'d7\'f7\'ce\'aa\'ca\'e4\'c8\'eb\'ca\'b1\'ce\'c4\'b1\'be\'bf\'c9\'d2\'d4\'d7\'d4\'b6\'af\'bb\'bb\'d0\'d0\'a3\'ac
\f1 \cf0 \
    \cf3 //textField 
\f0 \'d7\'f7\'ce\'aa\'ca\'e4\'c8\'eb\'bf\'f2\'b5\'c4\'ca\'b1\'ba\'f2\'a3\'ac\'b2\'bb\'c4\'dc\'bb\'bb\'d0\'d0
\f1 \cf0  \

\f0 \'d7\'a2\'d2\'e2\'a3\'ba
\f1 \
    
\f0 \cf3 \'c8\'e7\'b9\'fb\'b0\'d1
\f1 UITextView
\f0 \'b5\'b1\'d3\'c3\'cf\'d4\'ca\'be\'bf\'d8\'bc\'fe\'d3\'c3\'a3\'ac\'c4\'c7\'c3\'b4\'d4\'da\'bc\'c6\'cb\'e3\'ce\'bb\'d6\'c3\'b5\'c4\'ca\'b1\'ba\'f2\'a3\'ac\'d2\'bb\'b6\'a8\'d2\'aa\'d7\'a2\'d2\'e2\'cb\'fc\'bb\'e1\'d7\'d4\'b6\'af\'c9\'cf\'cf\'c2\'d7\'f3\'d3\'d2\'b8\'f7\'c1\'f4\'b0\'cb\'b8\'f6\'b5\'a5\'ce\'bb\'b5\'c4\'be\'e0\'c0\'eb
\b\fs60 \cf2 \expnd0\expndtw0\kerning0
\CocoaLigature1 \
\pard\pardeftab720\qj
\cf2 \
\
\pard\tx1204\pardeftab1204\pardirnatural

\f1\b0\fs50 \cf4 \kerning1\expnd0\expndtw0 \CocoaLigature0 @interface\cf0  \cf5 ViewController\cf0  ()<\cf6 UITextViewDelegate\cf0 >\
\cf4 @end\cf0 \
\cf4 @implementation\cf0  ViewController\
- (\cf4 void\cf0 )viewDidLoad \{\
    [\cf4 super\cf0  \cf7 viewDidLoad\cf0 ];\
    \cf4 self\cf0 .\cf8 view\cf0 .\cf8 backgroundColor\cf0  = [\cf6 UIColor\cf0  \cf7 grayColor\cf0 ] ;\
\pard\tx1204\pardeftab1204\pardirnatural

\f0\b\fs60 \cf2 \expnd0\expndtw0\kerning0
\CocoaLigature1 \
\pard\tx1204\pardeftab1204\pardirnatural

\f1\b0\fs50 \cf6 \kerning1\expnd0\expndtw0 \CocoaLigature0 	UITextView\cf0  * textView = [[\cf6 UITextView\cf0  \cf7 alloc\cf0 ] \cf7 initWithFrame\cf0 :\cf7 CGRectMake\cf0 (\cf9 50\cf0 , \cf9 100\cf0 , \cf9 200\cf0 , \cf9 80\cf0 )] ;\
    \cf3 //
\f0 \'c8\'e7\'b9\'fb\'d2\'aa\'d3\'c3\'d3\'da\'cf\'d4\'ca\'be\'b9\'a6\'c4\'dc\'a3\'ac\'cf\'c8\'b9\'d8\'b1\'d5\'b1\'e0\'bc\'ad\'b9\'a6\'c4\'dc
\f1 \cf0 \
    textView.\cf8 editable\cf0  = \cf4 NO\cf0  ;\
    \cf3 //
\f0 \'c9\'e8\'d6\'c3\'d5\'e2\'b8\'f6\'ca\'f4\'d0\'d4\'a3\'ac
\f1 textView
\f0 \'be\'cd\'bf\'c9\'d2\'d4\'ca\'b6\'b1\'f0\'b5\'e7\'bb\'b0\'ba\'c5\'c2\'eb\'a3\'ac\'d3\'ca\'cf\'e4\'a3\'ac\'b5\'d8\'d6\'b7\'a3\'ac\'cd\'f8\'d6\'b7
\f1 \cf0 \
    textView.\cf8 dataDetectorTypes\cf0  = \cf7 UIDataDetectorTypeAll\cf0  ;\
    \
    textView.\cf8 text\cf0  = \cf10 @\'93
\f0 \'c8\'ce\'d0\'a1\'c3\'f9\'b5\'e7\'bb\'b0
\f1 13011011911,www.baidu.com,
\f0 \'ba\'fe\'b1\'b1\'ca\'a1\'ce\'e4\'ba\'ba\'ca\'d0\'bd\'ad\'cf\'c4\'c7\'f8
\f1 ,www.wuhan@163.com"\cf0  ;\
    \
    textView.\cf8 font\cf0  = [\cf6 UIFont\cf0  \cf7 systemFontOfSize\cf0 :\cf9 20\cf0 ] ;\
    \
    textView.\cf8 textColor\cf0  = [\cf6 UIColor\cf0  \cf7 redColor\cf0 ] ;\
    \
    textView.\cf8 delegate\cf0  = \cf4 self\cf0  ;\
    \
\pard\tx1204\pardeftab1204\pardirnatural
\cf3 //    textView.inputView\cf0 \
\cf3 //    textView.inputAccessoryView\cf0 \
\cf3 //    textView.keyboardType\cf0 \
\cf3 //    textView.returnKeyType\cf0 \
    \
    [\cf4 self\cf0 .\cf8 view\cf0  \cf7 addSubview\cf0 :textView] ;\
    \
\}\
\
\pard\tx1204\pardeftab1204\pardirnatural
\cf11 #pragma mark -- UITextViewDelegate\
\pard\tx1204\pardeftab1204\pardirnatural
\cf3 //
\f0 \'d4\'da\'d5\'e2\'b8\'f6\'c0\'ef\'c3\'e6\'d7\'ee\'ba\'c3\'d7\'f6\'ca\'fd\'d7\'d6\'ba\'cd\'d3\'a2\'ce\'c4\'b5\'c4\'ca\'e4\'c8\'eb\'cf\'de\'d6\'c6
\f1 \cf0 \
- (\cf4 BOOL\cf0 )textView:(\cf6 UITextView\cf0  *)textView shouldChangeTextInRange:(\cf8 NSRange\cf0 )range replacementText:(\cf6 NSString\cf0  *)text\
\{\
\cf3 //    NSLog(@"%ld ------text: %@",range.location,text) ;\cf0 \
\cf3 //    NSLog(@"%ld",textView.text.length) ;\cf0 \
    \cf4 if\cf0  (textView.\cf8 text\cf0 .\cf8 length\cf0  > \cf9 10\cf0 )\
    \{\
        \cf4 return\cf0  \cf4 NO\cf0  ;\
    \}\
    \cf4 return\cf0  \cf4 YES\cf0  ;\
\}\
\cf3 //
\f0 \'d7\'f6\'d6\'d0\'ce\'c4\'ca\'e4\'c8\'eb\'cf\'de\'d6\'c6\'d4\'da\'d5\'e2\'b8\'f6\'b7\'bd\'b7\'a8\'d6\'d0\'ca\'b5\'cf\'d6
\f1 \cf0 \
- (\cf4 void\cf0 )textViewDidChange:(\cf6 UITextView\cf0  *)textView\
\{\
    \cf6 NSString\cf0  * str = textView.\cf8 text\cf0  ;\
    \
    \cf4 if\cf0  (textView.\cf8 text\cf0 .\cf8 length\cf0  >= \cf9 10\cf0 )\
    \{\
        str = [str \cf7 substringToIndex\cf0 :\cf9 10\cf0 ] ;\
        textView.\cf8 text\cf0  = str ;\
    \}\
    \cf7 NSLog\cf0 (\cf10 @"%@"\cf0 ,textView.\cf8 text\cf0 ) ;\
\}\
*************************************\

\f0\b\fs60 \cf2 \expnd0\expndtw0\kerning0
\CocoaLigature1 \

\f1\b0\fs50 \cf0 \kerning1\expnd0\expndtw0 \CocoaLigature0 - (\cf4 BOOL\cf0 )textViewShouldBeginEditing:(\cf6 UITextView\cf0  *)textView\
\{\
    \cf7 NSLog\cf0 (\cf10 @\'93
\f0 \'bd\'ab\'d2\'aa\'bf\'aa\'ca\'bc\'b1\'e0\'bc\'ad
\f1 \'94\cf0 ) ;\
\}
\f0\b\fs60 \cf2 \expnd0\expndtw0\kerning0
\CocoaLigature1 \

\f1\b0\fs50 \cf0 \kerning1\expnd0\expndtw0 \CocoaLigature0 \
- (\cf4 BOOL\cf0 )textViewShouldEndEditing:(\cf6 UITextView\cf0  *)textView\
\{\
    \cf7 NSLog\cf0 (\cf10 @\'93
\f0 \'bd\'ab\'d2\'aa\'cd\'ea\'b3\'c9\'b1\'e0\'bc\'ad
\f1 \'94\cf0 ) ;\
\}\
\
- (\cf4 void\cf0 )textViewDidBeginEditing:(\cf6 UITextView\cf0  *)textView\
\{\
    \cf7 NSLog\cf0 (\cf10 @\'93
\f0 \'bf\'aa\'ca\'bc\'b1\'e0\'bc\'ad
\f1 \'94\cf0 ) ;\
\}\
\
- (\cf4 void\cf0 )textViewDidEndEditing:(\cf6 UITextView\cf0  *)textView\
\{\
    \cf7 NSLog\cf0 (\cf10 @\'93
\f0 \'cd\'ea\'b3\'c9\'b1\'e0\'bc\'ad
\f1 \'94\cf0 ) ;\
\}\
\
- (\cf4 BOOL\cf0 )textView:(\cf6 UITextView\cf0  *)textView shouldChangeTextInRange:(\cf8 NSRange\cf0 )range replacementText:(\cf6 NSString\cf0  *)text\
\{\
    \cf7 NSLog\cf0 (\cf10 @\'93
\f0 \'bd\'ab\'d2\'aa\'b8\'c4\'b1\'e4\'c4\'da\'c8\'dd
\f1 \'94\cf0 ) ;\
\}\
\
- (\cf4 void\cf0 )textViewDidChange:(\cf6 UITextView\cf0  *)textView\
\{\
    \cf7 NSLog\cf0 (\cf10 @\'93
\f0 \'c4\'da\'c8\'dd\'cd\'ea\'b3\'c9\'b8\'c4\'b1\'e4
\f1 \'94\cf0 ) ;\
\}\
\
- (\cf4 void\cf0 )textViewDidChangeSelection:(\cf6 UITextView\cf0  *)textView\
\{\
    \cf7 NSLog\cf0 (\cf10 @\'93
\f0 \'c4\'da\'c8\'dd\'b1\'bb\'d1\'a1\'d6\'d0
\f1 \'94\cf0 ) ;\
\}\

\f0\b\fs60 \cf2 \expnd0\expndtw0\kerning0
\CocoaLigature1 \
\pard\pardeftab720\qj
\cf2 \
\
}